# -*- coding: utf-8 -*-

from odoo import models, fields, api

class openacademy(models.Model):
    _name = 'openacademy.openacademy'

    name = fields.Char()
    value = fields.Integer()
    value2 = fields.Float(compute="_value_pc", store=True)
    description = fields.Text()

    @api.depends('value')
    def _value_pc(self):
        self.value2 = float(self.value) / 100

class course(models.Model):
    _name = 'openacademy.course'

    name = fields.Char(require=True, string="课程名称")
    description = fields.Text(string="课程描述")
    session_id = fields.Many2one()


class session(models.Model):
    _name = 'openacademy.session'

    name = fields.Char()
